<template>
  <a-card :bordered="false" class="card-area">
    <!-- 查询区域 11111-->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" :label-col="labelCol" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">

        </span>
        </a-row>
      </a-form>
    </div>
    <a-row>
      <div class="d-a-c lh30 ww100 pt16">
        <div class="pt30 tc" style="width: 80px;">
          <p class="f20 fb gray9">今日</p>
          <p class="gray9">昨日</p>
          <p class="gray9">全部</p>
        </div>
        <div class="flex-1 tc">
          <p>销售额（元）</p>
          <p class="f20 fb gray3">{{ today.totalAmount }}</p>
          <p class="gray">{{ yesterday.totalAmount }}</p>
          <p class="gray">{{ all.totalAmount }}</p>
        </div>
        <div class="flex-1 tc">
          <p>预计收入（元）</p>
          <p class="f20 fb gray3">{{ today.incomeAmount }}</p>
          <p class="gray">{{ yesterday.incomeAmount }}</p>
          <p class="gray">{{ all.incomeAmount }}</p>
        </div>
        <div class="flex-1 tc">
          <p>退款金额（元）</p>
          <p class="f20 fb gray3">{{ today.refundAmount }}</p>
          <p class="gray">{{ yesterday.refundAmount }}</p>
          <p class="gray">{{ all.refundAmount }}</p>
        </div>
      </div>
    </a-row>

    <!-- 操作按钮区域 -->
    <div class="table-operator">

    </div>

    <!-- table区域-begin -->
    <div style="margin-top: 20px">
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange">


      </a-table>
    </div>
    <!-- table区域-end -->
  </a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { putAction, getAction, postAction } from '@/api/manage'
import { frozenBatch } from '@/api/api'
import JDate from '@/components/jeecg/JDate'

export default {
  name: 'ord_store_memberList',
  mixins: [JeecgListMixin],
  components: {
    JDate
  },
  data() {
    return {
      description: '资质',
      labelCol: { style: { width: '110px' } },
      // 表头
      // 表头
      columns: [
        {
          title: '订单号',
          align: 'center',
          dataIndex: 'orderNo',
          width: 250
        },
        {
          title: '订单类型',
          align: 'center',
          dataIndex: 'orderType',
          customRender: function(t, r, index) {
            //订单类型 1一体机订单 2.商城订单 3上门护理 4上门照护 5陪诊服务 6慢性康复 7营养指导
            if (t == 1) {
              return '一体机订单'
            }else if (t == 2) {
              return '商城订单'
            }else if (t == 3) {
              return '上门护理'
            }else if (t == 4) {
              return '上门照护'
            }else if (t == 5) {
              return '陪诊服务'
            }else if (t == 6) {
              return '慢性康复'
            }else if (t == 7) {
              return '营养指导'
            }
            return ''
          },
          width: 130
        },
        {
          title: '实付金额',
          align: 'center',
          dataIndex: 'consumeAmount',
          width: 130
        },
        {
          title: '收入金额',
          align: 'center',
          dataIndex: 'storeAmount',
          width: 130
        },
        {
          title: '退款金额',
          align: 'center',
          dataIndex: 'refundMoney',
          width: 130
        },
        {
          title: '支付状态',
          align: 'center',
          dataIndex: 'payStatus_dictText',
          width: 130
        },
        {
          title: '创建时间',
          align: 'center',
          dataIndex: 'createTime',
          width: 130
        }
      ],
      url: {
        list: '/store/order/list',
        finance: '/ch/finance/settled'
      },
      storeList: [],
      today: {
        incomeAmount: 0,
        waitTakeAmount: 0,
        finishTakeAmount: 0,
        refundAmount: 0,
        totalAmount: 0
      },
      yesterday: {
        incomeAmount: 0,
        waitTakeAmount: 0,
        finishTakeAmount: 0,
        refundAmount: 0,
        totalAmount: 0
      },
      all: {
        incomeAmount: 0,
        waitTakeAmount: 0,
        finishTakeAmount: 0,
        refundAmount: 0,
        totalAmount: 0
      }
    }
  },
  created() {
    this.searchFinance()
  },
  methods: {
    searchFinance() {
      const that = this
      getAction(this.url.finance ,{"timeType":"0"}).then((res) => {
        if (res.success) {
          that.all = res.result
        }
      })
      getAction(this.url.finance,{"timeType":"1"}).then((res) => {
        if (res.success) {
          that.today = res.result
        }
      })
      getAction(this.url.finance,{"timeType":"2"}).then((res) => {
        if (res.success) {
          that.yesterday = res.result
        }
      })

    }
  }
}
</script>
<style scoped>
.ww100 {
  width: 100%;
}

.d-a-c {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.pt30 {
  padding-top: 30px;
}

.lh30 {
  line-height: 30px;
}

.pt16 {
  padding-top: 16px;
}

.flex-1 {
  flex: 1;
}

.tc {
  text-align: center;
}

.fb {
  font-weight: 700;
}

.f20 {
  font-size: 20px;
}

.gray3 {
  color: #333;
}

.gray {
  color: #ccc;
  width: auto;
}

p {
  margin-top: 0;
  margin-bottom: 1em;
}

p {
  display: block;
  margin-block-start: 1em;
  margin-block-end: 1em;
  margin-inline-start: 0px;
  margin-inline-end: 0px;
}
</style>
